package com.vnas.utils;

public class Date {

	private int day, month, year;
	
	public Date()
	{
		day = Utils.getCurDay();	
		month = Utils.getCurMonth();
		year = Utils.getCurYear();
	}
	
	public Date(int d, int m, int y)
	{
		day = d;
		month = m;
		year = y;
	}
	
	public Date getDate()
	{
		return this;
	}
	public Date getPrevDay()
	{
		
		Date p = getDate();
		int temp = day-1;
		if(temp == 0)
		{
			if(p.month - 1 > 0)
				p.day = Utils.getMaxDayOfMonth(p.month - 1);
			else
			{
				p.day = Utils.getMaxDayOfMonth(12);
				p.month = 12;
				p.year--;
			}
				
		}
		else
		{
			p.day--;
		}
		return p;
			
	}
	public Date getPrevMonth()
	{
		Date p = getDate();
		if(p.month - 1<= 0)
		{
			p.month = 12;
			p.year --;
		}
		else
		{
			p.month --;
		}
		return p;
	}
	
	public int getMonth()
	{
		return this.month;
	}
	public int getDay()
	{
		return this.day;
	}
	public int getYear()
	{
		return this.year;
	}
}
